import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import path from "path"

export default defineConfig({
	plugins: [vue()],
	resolve: {
		alias: {
			"@": path.resolve("./src")
		}
	},
	lintOnSave: false,
	server: {
		//主要是加上这段代码
		host: "127.0.0.1",
		port: 3000,
		proxy: {
			"/api": {
				target: "http://127.0.0.1:8081", //实际请求地址
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, "")
			}
		}
	}
})
